package cn.edu.tju.fctl.service.impl;

import cn.edu.tju.fctl.dao.LeaveLogMapper;
import cn.edu.tju.fctl.entities.LeaveLog;
import cn.edu.tju.fctl.service.ILeaveLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by catold on 15/12/25.
 */
@Service
public class LeaveLogService implements ILeaveLogService{
    @Autowired
    private LeaveLogMapper leaveLogMapper;

    @Override
    public LeaveLog findById(int id) {
        return leaveLogMapper.selectByPrimaryKey(id);
    }

    @Override
    public int update(LeaveLog leaveInfo) {
        return leaveLogMapper.updateByPrimaryKey(leaveInfo);
    }

    @Override
    public int create(LeaveLog leaveInfo) {
        leaveLogMapper.insert(leaveInfo);
        return leaveInfo.getLeaveLogId();
    }

    @Override
    public List<LeaveLog> queryVacationLogById(int id) {
        return leaveLogMapper.findByLeaveID(id);
    }
}
